home *** CD-ROM | disk | FTP | other *** search
/ Compendium Deluxe 2 / LSD and 17bit Compendium Deluxe - Volume II.iso / a / prog / misc / gfront11.lha / GUIFront / Demos / Source / exchange2.c < prev    next >
C/C++ Source or Header  |  1994-11-01  |  4KB  |  156 lines

  1.  
  2. /* Exchange2.c - The GUI of the 'Exchange' utility
  3.  *
  4.  * This is a GUIFront example GUI. To build an example, compile and link this
  5.  * file with Generic.o (also supplied).
  6.  * Everything prefixed with DEMO_ is exported to Generic.o.
  7.  */
  8.  
  9. #include <libraries/guifront.h>
  10.  
  11. /* This GUI is the same as the 'Exchange.c' example, only we've added some
  12.  * frames to make it look better
  13.  */
  14.  
  15. /* First, some Gadget ID's */
  16.  
  17. enum
  18. {
  19.     GID_CXLIST,
  20.     GID_INFO,
  21.     GID_SHOW,
  22.     GID_HIDE,
  23.     GID_ACTIVATE,
  24.     GID_REMOVE,
  25. };
  26.  
  27. /* Some data and tag items we'll be needing later */
  28.  
  29. static const STRPTR activatelabels[] =
  30. {
  31.     "Active",
  32.     "Inactive",
  33.     NULL,
  34. };
  35.  
  36. static const struct TagItem activatetags[] =
  37. {
  38.     {GTCY_Labels, activatelabels},
  39.     {TAG_DONE},
  40. };
  41.  
  42. extern struct MinList cxlistlabels;
  43.  
  44. static struct Node cxlistnodes[] =
  45. {
  46.     {&cxlistnodes[1], (struct Node *)&cxlistlabels.mlh_Head, 0, 0, "AlertPatch"},
  47.     {&cxlistnodes[2], &cxlistnodes[0], 0, 0, "CScreen"},
  48.     {&cxlistnodes[3], &cxlistnodes[1], 0, 0, "CxAltNum"},
  49.     {&cxlistnodes[4], &cxlistnodes[2], 0, 0, "CxKeyClose"},
  50.     {&cxlistnodes[5], &cxlistnodes[3], 0, 0, "CycleToMenu"},
  51.     {&cxlistnodes[6], &cxlistnodes[4], 0, 0, "Exchange"},
  52.     {&cxlistnodes[7], &cxlistnodes[5], 0, 0, "PowerCache"},
  53.     {&cxlistnodes[8], &cxlistnodes[6], 0, 0, "RetinaComm"},
  54.     {&cxlistnodes[9], &cxlistnodes[7], 0, 0, "RetinaEMU"},
  55.     {&cxlistnodes[10], &cxlistnodes[8], 0, 0, "ToolManager"},
  56.     {(struct Node *)&cxlistlabels.mlh_Tail, &cxlistnodes[9], 0, 0, "WindX"},
  57. };
  58.  
  59. struct MinList cxlistlabels =
  60. {
  61.     (struct MinNode *)&cxlistnodes[0], NULL,(struct MinNode *)&cxlistnodes[10]
  62. };
  63.  
  64. static const struct TagItem cxlisttags[] =
  65. {
  66.     {GTLV_ShowSelected, NULL},
  67.     {GTLV_Labels, &cxlistlabels},
  68.     {TAG_DONE},
  69. };
  70.  
  71. static const struct TagItem infotags[] =
  72. {
  73.     {GTTX_Border, TRUE},
  74.     {TAG_DONE},
  75. };
  76.  
  77. /* Now, the GadgetSpec's we'll be needing for this GUI */
  78.  
  79. static GadgetSpec gadgetspecs[] =
  80. {
  81.     {LISTVIEW_KIND,30,6, {0,0,0,0,NULL, NULL, GID_CXLIST, PLACETEXT_ABOVE}, cxlisttags, GS_DefaultTags},
  82.     {TEXT_KIND,     0,2, {0,0,0,0,NULL, NULL, GID_INFO, PLACETEXT_ABOVE}, infotags, GS_DefaultTags},
  83.     {BUTTON_KIND,   0,0, {0,0,0,0,"_Show Interface", NULL, GID_SHOW, PLACETEXT_IN}, NULL, GS_DefaultTags},
  84.     {BUTTON_KIND,   0,0, {0,0,0,0,"_Hide Interface", NULL, GID_HIDE, PLACETEXT_IN}, NULL, GS_DefaultTags},
  85.     {CYCLE_KIND,    0,0, {0,0,0,0,NULL,NULL,GID_ACTIVATE,PLACETEXT_LEFT},activatetags,GS_DefaultTags},
  86.     {BUTTON_KIND,   0,0, {0,0,0,0,"_Remove", NULL, GID_REMOVE, PLACETEXT_IN}, NULL, GS_DefaultTags},
  87. };
  88.  
  89. /* Now, we group all of these GadgetSpecs into an array of pointers, so the
  90.  * layout engine can locate gadgets merely by their Gadget IDs.
  91.  */
  92.  
  93. GadgetSpec *DEMO_GadgetSpecList[] =
  94. {
  95.     &gadgetspecs[0], &gadgetspecs[1], &gadgetspecs[2], &gadgetspecs[2],
  96.     &gadgetspecs[3], &gadgetspecs[4], &gadgetspecs[5], NULL,
  97. };
  98.  
  99. /* Finally, the layout tag list itself. This is where most of the work is
  100.  * done. This list completely describes how the above gadgets are arranged
  101.  * in groups in the GUI.
  102.  */
  103.  
  104. ULONG DEMO_LayoutList[] =
  105. {
  106.     GUIL_Flags, GUILF_PropShare | GUILF_EqualHeight,
  107.  
  108.     GUIL_VertGroup, 1,
  109.         GUIL_Flags, GUILF_PropShare,
  110.         GUIL_FrameType, GUILFT_Ridge,
  111.         GUIL_FrameHeadline, "Available Commodities",
  112.         GUIL_GadgetSpecID, GID_CXLIST,
  113.     TAG_DONE,
  114.  
  115.     GUIL_VertGroup, 1,
  116.         GUIL_Flags, GUILF_PropShare | GUILF_EqualWidth,
  117.  
  118.         GUIL_FrameType, GUILFT_Ridge,
  119.         GUIL_FrameHeadline, "Information",
  120.  
  121.         GUIL_GadgetSpecID, GID_INFO,
  122.  
  123.         GUIL_HorizGroup, 1,
  124.             GUIL_Flags, GUILF_EqualShare | GUILF_EqualHeight,
  125.             GUIL_GadgetSpecID, GID_SHOW,
  126.             GUIL_GadgetSpecID, GID_HIDE,
  127.         TAG_DONE,
  128.  
  129.         GUIL_HorizGroup, 1,
  130.             GUIL_Flags, GUILF_EqualShare,
  131.             GUIL_GadgetSpecID, GID_ACTIVATE,
  132.             GUIL_GadgetSpecID, GID_REMOVE,
  133.         TAG_DONE,
  134.     TAG_DONE,
  135.  
  136.     TAG_DONE,
  137. };
  138.  
  139. /* Obligatory version tag */
  140.  
  141. static const char ver[] = "$VER: Exchange2 1.0 " __AMIGADATE__;
  142.  
  143. /* Now, some globals used by Generic.o during the call to GF_CreateGUIA() */
  144.  
  145. int DEMO_InitialOrientation = GUIL_HorizGroup;
  146.  
  147. STRPTR DEMO_WindowTitle = "Exchange GUI (2)";
  148. STRPTR DEMO_AppID       = "Exchange2";
  149.  
  150. STRPTR DEMO_Version     = "1.0",
  151.        DEMO_LongDesc    = "Demo program - Exchange with frames",
  152.        DEMO_Author      = "Michael Berg",
  153.        DEMO_Date        = __AMIGADATE__;
  154.  
  155. BOOL   DEMO_Backfill    = FALSE;
  156.